home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* File subsystem -- Download file *)
- (* *)
- (* Copyright 1988, 1989, 1990, 1991 by H. Roy Engehausen. All rights *)
- (* reserved. *)
- (* *)
- (*===========================================================================*)
-
- {$O+}
-
- UNIT BBFSD;
-
- INTERFACE
-
- PROCEDURE down_file_cmd(cmd_string : STRING);
-
- IMPLEMENTATION
-
- USES
- DOS,
- bbdummy,
- bbfsm,
- bbfssf,
- bblog,
- bbmdata,
- bbmess,
- bbmisc2,
- bbsdata,
- bbstr,
- bbtask,
- bbtime,
- bbwin,
- match;
-
- PROCEDURE down_file_cmd(cmd_string : STRING);
-
- VAR
- dir_to_search : fsb_name_str;
- i : WORD;
- look : SEARCHREC;
- search_arg : file_name_str;
- this_fsb : fsb_ptr;
- word_count : BYTE;
-
- {$I BBFSI.PAS}
-
- BEGIN;
-
- (*-----------------------------------------------------------------------*)
- (* Parse command and execute right routine *)
- (*-----------------------------------------------------------------------*)
-
- IF cmd_string[2] <> ' ' THEN
- BEGIN;
- send_message(message_err_2nd);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- upcase_str_var(cmd_string);
-
- word_count := words(cmd_string);
-
- IF word_count < 3 THEN
- BEGIN;
- send_message(message_not_en);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- IF word_count > 3 THEN
- BEGIN;
- send_message(message_err_wrd);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- (*-----------------------------------------------------------------------*)
- (* Parse *)
- (*-----------------------------------------------------------------------*)
-
- dir_to_search := subwordl(cmd_string, 2, SIZEOF(fsb_name_str) - 1);
-
- search_arg := subwordl(cmd_string, 3, SIZEOF(search_arg) - 1);
-
- (*-----------------------------------------------------------------------*)
- (* Find the directory *)
- (*-----------------------------------------------------------------------*)
-
- this_fsb := find_fsb(dir_to_search);
-
- IF (this_fsb = NIL) OR
- (active_tcb^.uid_data.user_class < this_fsb^.fsb_down) THEN
- BEGIN;
- send_message(message_no_files_one);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- (*-----------------------------------------------------------------------*)
- (* Check for subdirectory *)
- (*-----------------------------------------------------------------------*)
-
- IF (POS('\', search_arg) > 0) AND NOT this_fsb^.fsb_f_subdir_ok THEN
- BEGIN;
- send_message(message_no_slash);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- log_data_s(cmd_string);
-
- (*-----------------------------------------------------------------------*)
- (* Send the file *)
- (*-----------------------------------------------------------------------*)
-
- send_file(this_fsb^.fsb_path + search_arg,
- (active_tcb^.tcb_type = th_operator) AND (active_tcb^.conv_tcb <> NIL));
-
- END;
-
- END.